package com.lhl.fw.db.auditor;

import io.swagger.annotations.Api;
import org.springframework.data.domain.AuditorAware;

import java.util.Arrays;
import java.util.Optional;
import java.util.Random;

/**
 * @className: com.lhl.fw.db.auditor.AuditorAwareImpl
 * @description: TODO 类描述
 * @author: king
 * @date: 2021-02-05 10:42
 **/
@Api(tags = "AuditorAwareImpl", produces = "AuditorAwareImpl")
public class AuditorAwareImpl implements AuditorAware<String> {

    @Override
    public Optional<String> getCurrentAuditor() {
        // use Spring Security to retrive the currently logged-in user(s)
        return Optional.of(Arrays.asList("mark1990", "adrianm", "dan555")
                .get(new Random().nextInt(3)));
    }
}
